#include <iostream>
#include <string.h>
#include "Time.hpp"
#include "Fifo.hpp"
#include "ShareMemory.hpp"

int main()
{
    shm.GetShm();
    shm.AttachShm();

    gpipe.OpenPipeForWrite();

    // 这里进行IPC
    struct data *image = (struct data *)shm.GetAddr();
    // std::cout << "client 虚拟地址: " << strinfo << std::endl;
    //printf("server 虚拟地址: %p\n", strinfo);

    char ch = 'A';
    while (ch <= 'Z')
    {
        strcpy(image->status, "最新");
        strcpy(image->lasttime, GetCurrTime().c_str());
        strcpy(image->image, "xxxxxxxxxxxxxxxxxxxx");
        gpipe.Signal();
        sleep(3);

        // strinfo[ch-'A'] = ch; // 这里操作shm的时候，怎么没有用系统调用？？？
        // ch++;
    }

    shm.DetachShm();
    return 0;
}

